<?php

class Install_Form_Account extends Nuo_Form
{
	public function init()
	{

		// check domain
		$domain = $_SERVER['HTTP_HOST'];

		// email
		$this -> addElement('text', 'email', array(
				'label' => 'email',
				'required' => true,
				'value' => 'admin@' . $domain,
				'validators' => array('EmailAddress')
		));

		// username
		$this -> addElement('text', 'username', array(
				'label' => 'username',
				'required' => true,
				'value'=>'admin',
				'validators' => array('Alnum')
		));

		// username
		$this -> addElement('text', 'displayname', array(
				'label' => 'displayname',
				'required' => true,
		));

		// password
		$this -> addElement('password', 'password', array(
				'label' => 'password',
				'required' => true,
				'validators' => array( array(
							'StringLength',
							false,
							array(
									4,
									8
							)
					))
		));

		// password confirm
		$this -> addElement('password', 'password2', array(
				'label' => 'confirm password',
				'required' => true,
		));

		// locale
		$this -> addElement('select', 'locale', array(
				'label' => 'locale',
				'multiOptions' => array()
		));

		// timezone
		$this -> addElement('select', 'timezone', array(
				'label' => 'timezone',
				'multiOptions' => Nuo_Utility_Timezone::getAll()
		));

		$this -> addElement('select', 'gender', array(
				'label' => 'gender',
				'multiOptions' => array(
						'Male' => 'Male',
						'Female' => 'Female'
				)
		));

		// submit button
		$this -> addElement('button', '_submit', array(
				'label' => 'submit',
				'value' => 'submit',
				'type' => 'submit',
		));
	}

	// confirm password
	public function validatorConfirmPassword($value, $form)
	{
		return false;
	}

}
